<template>
  <div class="app">
    <router-view/>
  </div>

</template>

<script lang="ts" setup>
import {onBeforeMount, onBeforeUnmount} from 'vue'
import {useStore} from 'vuex'

/**
 * 仓库
 */
const store = useStore()
//websocket初始化
const initSocket = () => {
  store.commit('websocket/initWebsocket')
}

onBeforeMount(() => {
  //console.log('2.组件挂载页面之前执行----onBeforeMount')
  initSocket()
})

onBeforeUnmount(() => {
  store.commit('websocket/closeWebsocket');
});
</script>

<style lang="scss" scoped>
.app {
  width: 100vw;
  height: 100vh;
  background-color: #020308;
  overflow: hidden;
}
</style>

